package pure.engine.world 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Stage;
	import flash.events.EventDispatcher;
	import flash.net.getClassByAlias;
	import pure.debug.Logger;
	import pure.engine.model.Model2D;
	
	import pure.engine.model.Entity;
	import pure.engine.model.EntityManager;
	import pure.engine.model.IEntityFactory;
	import pure.engine.scenery.IScenery;
	import pure.engine.scenery.ImageScenery;
	import pure.engine.scenery.SceneryType;
	import pure.engine.scenery.TiledScenery;
	import pure.engine.core.SystemManager;
	import pure.engine.core.ns_despair;

	use namespace ns_despair;

	/// @eventType	pure.engine.events.InteractEvent.CLICK
	[Event(name="click", type="pure.engine.events.InteractEvent")] 

	/// @eventType	pure.engine.events.InteractEvent.PRESS
	[Event(name="press", type="pure.engine.events.InteractEvent")] 

	/// @eventType	pure.engine.events.InteractEvent.RELEASE
	[Event(name="release", type="pure.engine.events.InteractEvent")] 

	/// @eventType	pure.engine.events.InteractEvent.MOVE
	[Event(name="move", type="pure.engine.events.InteractEvent")] 
	
	/**
	 * 世界
	 * [Author] - PURE
	 * 
	 */
public class World extends EventDispatcher
{
	public function World(RX:int, RY:int, regionData:Array = null)
	{
		m_numRegionX = RX;
		m_numRegionY = RY;
		m_regionData = regionData;
	}
	
	
	/**
	 * 进入
	 */
	public function enter():void 
	{
	}

	
	/**
	 * 退出
	 */
	public function exit():void
	{	
	}
	
	
	/**
	 * 更新
	 */
	public function update():void
	{
	}

	
	
	/**
	 * 加入模型
	 * 
	 * [Param] - model  模型
	 * 
	 * [Hint] - 模型一旦加入，下一帧进入到WorldBody
	 */
	ns_despair function addModel(model:Model2D):void
	{	
		m_freshModelList[m_freshModelLength++] = model;
	}
	
	
	/**
	 * 重置
	 */
	ns_despair function reset():void
	{
		m_freshModelList.length = m_freshModelLength = 0;
	}
	
	
	/**
	 * 毁灭
	 */
	ns_despair function destroy():void
	{
		var l:int = m_freshModelLength;
		
		while (--l > -1)
		{
			m_freshModelList[l].destroy();
		}
		m_freshModelList = m_regionData = null;
	}
	
	
	
	
	
	//======================
	// Member
	//======================

	
	ns_despair var m_freshModelList:Array = [];  // 新入模型列表
	
	ns_despair var m_freshModelLength:int;  // 新入模型数量

	
	ns_despair var m_numRegionX:int  // 总区块数量x
	
	ns_despair var m_numRegionY:int;  // 总区块数量y
	
	ns_despair var m_regionData:Array;
}

}